<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QAxContainer Module</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAxContainer Module<br /></h1><p>The QAxContainer module provides classes for accessing ActiveX controls and COM objects. It is only available in the commercial version of PyQt for Windows. <a href="#details">More...</a></p><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAxContainer module provides classes for accessing ActiveX controls and
COM objects. It is only available in the commercial version of PyQt for
Windows.</p>

<p>To import the module use, for example, the following statement:</p>

<pre>from PyQt4 import QAxContainer</pre>

<p>The QAxContainer module provides a <a href="qwidget.html">QWidget</a> subclass, <a href="qaxwidget.html">QAxWidget</a>, that acts as a container for ActiveX controls, and a <a href="qobject.html">QObject</a> subclass, <a href="qaxobject.html">QAxObject</a>, that can be used to easily access non-visual COM objects.</p>
<p>The module consists of three classes</p>
<ol type="1">
<li><a href="qaxbase.html">QAxBase</a> is an abstract class that provides an API to initialize and access a COM object or ActiveX control.</li>
<li><a href="qaxobject.html">QAxObject</a> provides a <a href="qobject.html">QObject</a> that wraps a COM object.</li>
<li><a href="qaxwidget.html">QAxWidget</a> is a <a href="qwidget.html">QWidget</a> that wraps an ActiveX control.</li>
</ol>
<p>Topics:</p>
<ul><li><a href="#instantiating-com-objects">Instantiating COM Objects</a></li>
<ul><li><a href="#typical-error-messages">Typical Error Messages</a></li>
<ul><li><a href="#requested-control-could-not-be-instantiated">Requested control could not be instantiated</a></li>
</ul>
</ul>
<li><a href="#accessing-the-object-api">Accessing the Object API</a></li>
<ul><li><a href="#call-by-name">Call-by-Name</a></li>
<li><a href="#calling-a-function-using-the-native-com-interfaces">Calling a Function Using the Native COM Interfaces</a></li>
<li><a href="#typical-error-messages">Typical Error Messages</a></li>
<ul><li><a href="#qaxbase-internalinvoke-no-such-method">QAxBase.internalInvoke: No such method</a></li>
<li><a href="#error-calling-idispatch-member-non-optional-parameter-missing">Error calling IDispatch member: Non-optional parameter missing</a></li>
<li><a href="#error-calling-idispatch-member-type-mismatch-in-parameter-n">Error calling IDispatch member: Type mismatch in parameter n</a></li>
</ul>
</ul>
</ul>

<a name="instantiating-com-objects" />
<h3>Instantiating COM Objects</h3>
<p>To instantiate a COM object use the <a href="qaxbase.html#control-prop">QAxBase.setControl</a>() API, or pass the name of the object directly into the constructor of the <a href="qaxbase.html">QAxBase</a> subclass you are using.</p>
<p>The control can be specified in a variety of formats, but the fastest and most powerful format is to use the class ID (CLSID) of the object directly. The class ID can be prepended with information about a remote machine that the object should run on, and can include a license key for licensed controls.</p>
<a name="typical-error-messages" />
<h4>Typical Error Messages</h4>
<p><a href="activeqt.html#activeqt">ActiveQt</a> prints error messages to the debug output when it encounters error situations at runtime. Usually you must run your program in the debugger to see these messages (e.g. in Visual Studio's Debug output).</p>
<a name="requested-control-could-not-be-instantiated" />
<h5>Requested control could not be instantiated</h5>
<p>The control requested in <a href="qaxbase.html#control-prop">QAxBase.setControl</a>() is not installed on this system, or is not accessible for the current user.</p>
<p>The control might require administrator rights, or a license key. If the control is licensed, pass the license key to QAxBase.setControl as documented.</p>

<a name="accessing-the-object-api" />
<h3>Accessing the Object API</h3>
<p><a href="activeqt.html#activeqt">ActiveQt</a> provides a Qt API to the COM object, and replaces COM datatypes with Qt equivalents.</p>
<p>There are two ways to call APIs on the COM object:</p>
<ul>
<li>Call-by-name</li>
<li>Using the native COM interfaces</li>
</ul>

<a name="call-by-name" />
<h4>Call-by-Name</h4>
<p>Use <a href="qaxbase.html#dynamicCall">QAxBase.dynamicCall</a>() and <a href="qaxbase.html#querySubObject">QAxBase.querySubObject</a>() as well as the <a href="qobject.html#setProperty">QObject.setProperty</a>() and <a href="qobject.html#property">QObject.property</a>() APIs to call the methods and properties of the COM object through their name. Use the <a href="activeqt-dumpdoc.html#dumpdoc">dumpdoc</a> tool to get the documentation of the Qt API for any COM object and its subobjects; note that not all of the COM object's APIs might be avaiable.</p>
<p>See the <a href="activeqt-webbrowser.html">Webbrowser</a> example for more information.</p>

<a name="calling-a-function-using-the-native-com-interfaces" />
<h4>Calling a Function Using the Native COM Interfaces</h4>
<p>To call functions of the COM object that can not be accessed via any of the above methods it is possible to request the COM interface directly using <a href="qaxbase.html#queryInterface">QAxBase.queryInterface</a>(). To get a C++ definition of the respective interface classes use the <tt>#import</tt> directive with the type library provided with the control; see your compiler manual for details.</p>
<a name="typical-error-messages" />
<h4>Typical Error Messages</h4>
<p><a href="activeqt.html#activeqt">ActiveQt</a> prints error messages to the debug output when it encounters error situations at runtime. Usually you must run your program in the debugger to see these messages (e.g. in Visual Studio's Debug output).</p>
<a name="qaxbase-internalinvoke-no-such-method" />
<h5>QAxBase.internalInvoke: No such method</h5>
<p>A <a href="qaxbase.html#dynamicCall">QAxBase.dynamicCall</a>() failed - the function prototype did not match any function available in the object's API.</p>
<a name="error-calling-idispatch-member-non-optional-parameter-missing" />
<h5>Error calling IDispatch member: Non-optional parameter missing</h5>
<p>A <a href="qaxbase.html#dynamicCall">QAxBase.dynamicCall</a>() failed - the function prototype was correct, but too few parameters were provided.</p>
<a name="error-calling-idispatch-member-type-mismatch-in-parameter-n" />
<h5>Error calling IDispatch member: Type mismatch in parameter n</h5>
<p>A <a href="qaxbase.html#dynamicCall">QAxBase.dynamicCall</a>() failed - the function prototype was correct, but the paramter at index <tt>n</tt> was of the wrong type and could not be coerced to the correct type.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>